mybatisPlus写xml如何分页 | 您所在的位置:网站首页 › flux 分页 › mybatisPlus写xml如何分页 |
1、xml select * from school_student 1 2 3 2、Mapper 说明: 1、mybatis-plus中分页接口需要包含一个IPage类型的参数。 2、多个实体参数,需要添加@Param参数注解,方便在xml中配置sql时获取参数值。 注意这里我虽然加了@Param但是我并没有使用 Page getPageStudentTwo(Page rowPage,@Param("schoolStudent") SchoolStudent schoolStudent); 1 3、第一种写法 @Override public IPage getPageStudentTwo(Integer current, Integer size) { Page rowPage = new Page(current, size); SchoolStudent schoolStudent = new SchoolStudent(); rowPage = this.baseMapper.getPageStudentTwo(rowPage, schoolStudent); return rowPage; } 1 2 3 4 5 6 7 4、第一种结果 5、第二种写法 @Override public IPage getPageStudentThree(Integer current, Integer size) { SchoolStudent schoolStudent = new SchoolStudent(); Page pageStudentTwo = this.baseMapper.getPageStudentTwo(new Page(current, size), schoolStudent); return pageStudentTwo; } |
CopyRight 2018-2019 实验室设备网 版权所有 |